//
//  MeViewController.swift
//  swfitTest
//
//  Created by hncy on 2021/12/27.
//

import UIKit

class MeViewController: UIViewController {

    @IBOutlet weak var loginBtn: UIButton!
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.tabBarController?.navigationItem.title = "我的"
        // Do any additional setup after loading the view.
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.tabBarController?.navigationController?.setNavigationBarHidden(false, animated: true)
        
        if UserModel.isLogin() {
            self.loginBtn.setTitle("退出登录", for: .normal)
        } else {
            self.loginBtn.setTitle("登录", for: .normal)
        }
        
    }
   

    @IBAction func loginClick(_ sender: Any) {
        // 退出登录
        if UserModel.isLogin() {
            UserModel.loginOut()
            self.loginBtn.setTitle("登录", for: .normal)
        } else {
            UIUtils.pushViewController(parent: self, vc: TestViewController(), needLogin: true)
        }
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
